#pragma once

#include "OneWire.hpp"
#include <optional>

namespace model {
struct DHT11 {

  using DataModel = OneWire<5>;

  struct Value {
    uint8_t integral;
    uint8_t decimal;
  };

  using Option = std::optional<DHT11>;
  static Option construct(const DataModel &model);

  inline const Value &temperature() const { return t; }
  inline const Value &humidity() const { return h; }

private:
  DHT11(const DataModel &model);
  Value t;
  Value h;
};
} // namespace model
